<?php
if (defined("SITE")){
	$strSite = SITE;
	//$strSite.sprintf("%08d",$intOrderHeaderID)
}
unset($intTotal);
$strMessageBody = "<link rel='stylesheet' href='http://$SERVER_NAME/shop.css'>
	<table width='600'  STYLE='table-layout: fixed' align='center' class='Normal' border='0'>
	<tr>
		<td colspan='4' align='left' >
			Thank you for ordering from ".SITE_NAME."
			<br/>Detailed below is your order.
			<br/><hr></b>
		</td>
	</tr>
	<tr>
		<td colspan='2' align='left' class='Normal'>
			<b>Please Note Your Order number:</b>
		</td>
		<td colspan='2' align='right'>
			order ".$strSite.sprintf("%08d",$intOrderHeaderID)."
		</td>
	</tr>
	
	<tr>
		<td colspan='2' valign='top'>
			<br/><b>Invoice to:</b>
			<br/>".$myrow["ShipName"]."
			<br/>".$myrow["ShipAddress"];

				if ($myrow["ShipAddress2"]){
					$strMessageBody .= "<br/>".$myrow["ShipAddress2"];
				}
		
$strMessageBody .= "
			<br/>".$myrow["ShipCity"]."
			<br/>".$myrow["ShipRegion"]."
			<br/>".$myrow["ShipPostalCode"]."
		</td>

		<td colspan='2' valign='top'>
			<br/><b>Deliver to:</b>
			<br/>".$myrow["DeliveryName"]."
			<br/>".$myrow["DeliveryAddress"];

				if ($myrow["DeliveryAddress2"]){
					$strMessageBody .= "<br/>".$myrow["DeliveryAddress2"];
				}
		
$strMessageBody .= "
			<br/>".$myrow["DeliveryCity"]."
			<br/>".$myrow["DeliveryRegion"]."
			<br/>".$myrow["DeliveryPostalCode"]."
		</td>
	</tr>
	
	<tr>
		<td colspan='4'>
			<br/><HR>
			<br/>
			<br/><b>Email:</b>&nbsp;".$_SESSION['sesUserName']."
			<br/><b>Phone:</b>&nbsp;".$myrow["ShipPhone"]."
			<br/>
";
			if(EXTRA_ORDER_FIELD){
				$strMessageBody .= "<b>".EXTRA_ORDER_FIELD."</b>".$myrow["OtherInfo"]."<br/>";
			}
			
$strMessageBody .= "
		</td>
	</tr>
	
	<tr align='center'>
        <td colspan='1'  align='left' width='280'><b>Product</b></td>
		<td  align='right'  width='85'><b>qty</b></td>
		<td align='right'  width='85'><b>".CURRENCY."</b></td>
		<td align='right' width='150'><b>Total</b></td>
    </tr>";
	
	include (MODULE . "/action/qrySelectOrderDetails");
	do{
		if($myrow["PromotionalItem"] == "1"){
				// $strBackgroundImage = "background='./images/PromotionalItem.jpg'";	
				 $strPromotional = $strPromotionalFlag;
		}else{
		  $strPromotional = "";
		}
		$strMessageBody .= "<tr align='right' bgcolor=\"".switch_background($boBG)."\" class='.CheckoutProductDetail'>
	 		<td align='left'  width='280'>".$myrow["QuantityPerUnit"]."&nbsp;".$myrow["Product"]."&nbsp;".$myrow["OwnProductCode"].$strPromotional;
			
			if($myrow["Colour"]){
				$strMessageBody .= "&nbsp; Colour: ".$myrow["Colour"];
			}
								
			if($myrow["Size"]){
				$strMessageBody .= "&nbsp;Size: ".$myrow["Size"];
			}
		
		$strMessageBody .= "
		</td>
	        <td  width='85'>".$myrow["Quantity"]."</td>
	        <td  width='85'>".$myrow["UnitPrice"]."</td>
			<td  width='150'>".CURRENCY."".$myrow["Amount"]."</td>
	    </tr>";
		$boBG = -1 - $boBG; //alternate $boBG values from -1 and 0
		$intTotal = $intTotal + $myrow["Amount"];
	} while ($myrow = mysql_fetch_array($result));
	
	$intTotal = $intTotal + CARRIAGE;
	
    $strMessageBody .= "<tr>
        <td colspan='3' align='left'>Carriage</td>
		<td  align='right'>";
		
			if (CARRIAGE != "0.00"){
				 $strMessageBody .= "".CURRENCY."".number_format(CARRIAGE, 2, '.', '');
			}else{
				 $strMessageBody .= "<span class='Small'>Included</span>";
			}
		
	
	$strMessageBody .= "
		</td>
    </tr>
	
	<tr>";
		if($SHOP_TYPE != "Trade"){
 			$strMessageBody .= "<td colspan='3' align='left'><b>Total</b></td>";
		}else{
			$strMessageBody .= "<td colspan='3' align='left'><b>Total excluding VAT</b></td>";
		}
		
	$strMessageBody .= "
		<td  align='right'><b>".CURRENCY."".number_format($intTotal, 2, '.', '')."</b></td>
    </tr>
	
	<tr>
 		<td colspan='4'><br/>
			".BASKET_MESSAGE."<br/>
			<p>".ORDER_CONFIRMATION_MESSAGE."</p>
			<p>".ORDER_CONFIRMATION_VAT_MESSAGE."</p>
		</td>
    </tr>
	
</table>";

?>